/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 导航栏样式 */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-brand {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-brand i {
    margin-right: 10px;
    font-size: 1.8rem;
}

.nav-menu {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.2);
}

/* 用户信息样式 */
.user-info {
    display: flex;
    align-items: center;
    background-color: rgba(255,255,255,0.15);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.3);
    backdrop-filter: blur(10px);
}

.welcome-text {
    color: rgba(255,255,255,0.9);
    font-size: 0.9rem;
    margin-right: 4px;
}

.username {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 表单样式 */
.form-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    max-width: 500px;
    margin: 20px auto;
}

.form-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    margin-right: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
}

/* 文章列表样式 */
.posts-container h2 {
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

.post-item {
    background: white;
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.post-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.post-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
    cursor: pointer;
    transition: color 0.3s;
}

.post-title:hover {
    color: #667eea;
}

.post-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.post-meta i {
    margin-right: 5px;
}

.post-content {
    color: #555;
    line-height: 1.8;
    margin-bottom: 15px;
}

.post-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* 文章详情样式 */
.post-detail {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.post-detail h1 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #333;
}

.post-detail .post-meta {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.post-detail .post-content {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 30px;
}

/* 评论样式 */
.comments-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.comments-section h3 {
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.comments-section h3::before {
    content: "💬";
    font-size: 1.2rem;
}

.comment-item {
    background: #ffffff !important;
    padding: 20px !important;
    margin-bottom: 15px !important;
    border-radius: 8px !important;
    border-left: 4px solid #667eea !important;
    border: 1px solid #dee2e6 !important;
    transition: transform 0.2s, box-shadow 0.2s;
    display: block !important;
    width: 100% !important;
    position: relative !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 60px !important;
}

.comment-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: #666;
    font-size: 0.9rem;
}

.comment-content {
    color: #555;
    line-height: 1.6;
    word-wrap: break-word;
}

/* 评论表单样式 */
#commentForm textarea,
.comment-form textarea {
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#commentForm textarea:focus,
.comment-form textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 评论列表样式 */
.comments-list {
    margin-top: 15px !important;
    padding: 15px !important;
    background: #f8f9fa !important;
    border-radius: 8px !important;
    border: 1px solid #e9ecef !important;
    min-height: 50px !important;
    width: 100% !important;
    position: relative !important;
    z-index: 1 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 评论表单样式 */
.comment-form {
    margin-top: 15px !important;
    padding: 15px !important;
    background: #f8f9fa !important;
    border-radius: 8px !important;
    border: 1px solid #e9ecef !important;
    width: 100% !important;
    position: relative !important;
    z-index: 1 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 评论项样式 */
.comment-item {
    margin-bottom: 15px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f0f0f0;
}

.comment-author {
    font-weight: 600;
    color: #333;
    margin-right: 10px;
}

.comment-date {
    color: #666;
    font-size: 0.85rem;
    flex-grow: 1;
}

.comment-delete {
    margin-left: 10px;
    font-size: 0.8rem !important;
    padding: 2px 8px !important;
    min-width: auto !important;
}

/* 统一评论meta样式 */
.comment-meta span {
    margin-right: 15px;
}

.comment-meta span:last-child {
    margin-right: 0;
}

.comment-meta i {
    margin-right: 5px;
    color: #999;
}

.comment-content {
    color: #555;
    line-height: 1.5;
    word-wrap: break-word;
}

.no-comments {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 20px;
}

/* 评论按钮区域 */
.comment-actions {
    display: flex !important;
    gap: 10px !important;
    margin-top: 15px !important;
    width: 100% !important;
    position: relative !important;
    z-index: 1 !important;
}

.char-counter {
    text-align: right;
    margin-top: 5px;
    font-size: 0.9rem;
    transition: color 0.3s;
}

/* 提交按钮禁用状态 */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    gap: 10px;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .current-page {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

/* 消息提示样式 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    font-weight: 500;
    z-index: 2000;
    transform: translateX(400px);
    transition: transform 0.3s;
}

.message.show {
    transform: translateX(0);
}

.message.success {
    background-color: #28a745;
}

.message.error {
    background-color: #dc3545;
}

.message.info {
    background-color: #17a2b8;
}

/* 加载指示器 */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.95);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    text-align: center;
    z-index: 2000;
}

.loading i {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 10px;
}

.loading span {
    display: block;
    color: #333;
    font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .container {
        padding: 10px;
    }
    
    .form-container {
        margin: 10px;
        padding: 20px;
    }
    
    .post-item {
        padding: 20px;
    }
    
    .post-detail {
        padding: 20px;
    }
    
    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .post-actions {
        flex-wrap: wrap;
    }
    
    .comment-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}
